interface IData<T> {
  code: number
  message: string
  data: T
}

/* type User = IData<number[]>
type Goods = IData<string[]> */

/* const o1: IData<string> = {
  code: 8,
  message: '成功',
  data: 'abc'
} */

interface IdFunc<T> {
  id: () => T
  ids: () => T[]
}


/* const o1:IdFunc<string> = {
  id: () => 'acb',
  ids: () => ['a', 'b']
} */

/* const o1:IdFunc<number> = {
  id: () => 1,
  ids: () => [1, 2]
} */

// 推荐
// const arr: number[] = [1, 3]

/* interface IArray<T> {
  // key 是 number 类型，value 是传递过来的 T 类型
  [k: number]: T
}
const arr1: IArray<number> = [1, 3]
const arr2: IArray<string> = ['a', 'b'] */

export {}